package com.example.tests;

import org.testng.annotations.Test;

public class ContactTests extends BaseClass {

	@Test
	public void shouldCreateContactWithAllFields() throws Exception {
		app.getNavigationHelper().gotoMainPage();
		app.getNavigationHelper().clicktoAddNewContact();
		ContactFields contact = new ContactFields();
		contact.setFirstName("Elena");
		contact.setLastName("Mekhanoshina");
		contact.setAddress("Saint Petersburg");
		contact.setHome("Russia");
		contact.setHomePhone("+7812");
		contact.setMobilePhone("+7921");
		contact.setWorkPhone("+7812");
		contact.setEmail1("email1@mail.mail");
		contact.setEmail2("email2@mail.mail");
		contact.setBDay("1");
		contact.setBMonth("December");
		contact.setBYear("2012");
		contact.setSecondaryAddress("Los Angeles");
		contact.setSecondaryHomePhone("+0");
		app.getContactHelper().createContact(contact);
		app.getNavigationHelper().gotoMainPage();
	}
	
	@Test
	public void shouldCreateContactWithNoFields() throws Exception {
		app.getNavigationHelper().gotoMainPage();
		app.getNavigationHelper().clicktoAddNewContact();
		app.getContactHelper().createContact(new ContactFields());
		app.getNavigationHelper().gotoMainPage();
	}
	
	@Test
	public void shouldEditFirstContactInTheList() throws Exception {
		app.getNavigationHelper().gotoMainPage();
		ContactFields contact = new ContactFields();
		contact.setFirstName("Edited first name");
		contact.setLastName("Edited last name");
		app.getContactHelper().editContact(contact);
		app.getNavigationHelper().gotoMainPage();
	}
	
	@Test
	public void shouldDeleteFirstContactInTheList() throws Exception {
		app.getNavigationHelper().gotoMainPage();
		app.getContactHelper().deleteContact();
		app.getNavigationHelper().gotoMainPage();
	}

}
